﻿using B.S.AuthCenter.Api.Write.Application.Command.Users;
using B.S.AuthCenter.Domain;
using B.S.AuthCenter.ErrorCount;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.AuthCenter.Api.Write.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [Authorize]
    public class UsersController : ControllerBase
    {
        IMediator mediator;

        public UsersController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        [HttpPost]
        public Task<ApiResult<int>> AddUser(AddUsersCommand request)
        {
            return mediator.Send(request);
        }
        [HttpPut]
        public Task<ApiResult<int>> DelUser(DelUsersCommand request)
        {
            return mediator.Send(request);
        }
        [HttpPut]
        public Task<ApiResult<int>> UpdateUser(UpdateUsersCommand request)
        {
            return mediator.Send(request);
        }
       
    }
}
